package com.smartstate.ems.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.smartstate.ems.dto.AlarmDTO;
import com.smartstate.ems.dto.PageDTO;
import com.smartstate.ems.entity.Alarm;
import com.smartstate.ems.service.AlarmService;
import com.smartstate.ems.vo.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@Api(tags = {"报警信息"})
@RequestMapping("/Alarm")
public class AlarmController {

    @Resource
    private AlarmService alarmService;

    @PostMapping("/pageAlarm")
    @ApiOperation(value = "设备报警分页")
    public Page<Alarm> pageAlarm(@RequestBody PageDTO<AlarmDTO> pageDTO) {
        return alarmService.queryAllPageByDTO(pageDTO);
    }


    @PostMapping("/figureOut")
    @ApiOperation(value = "处理完成")
    public ResultVO<Boolean> figureOut(@RequestBody Alarm alarm) {
        return ResultVO.ok(alarmService.figureOut(alarm));
    }


}